import grok
from zope import interface
from interfaces import IArticle
from datetime import datetime

class Article(grok.Model):
    """ 
    An article with a title and an issue date.

      >>> article = Article("Grok Sprint Zwei: the Ascent of Man", issued=datetime(2007,1,9))
      >>> article.title
      'Grok Sprint Zwei: the Ascent of Man'
      >>> article.issued
      datetime.datetime(2007, 1, 9, 0, 0)

    Article objects also have methods used only for indexing itself on the site catalog:

      >>> article.searchableText()
      'Grok Sprint Zwei: the Ascent of Man'

    """
    interface.implements(IArticle)
    title = ''
    issued = ''

    def __init__(self, title='', issued=datetime.now()):
        super(Article, self).__init__()
        self.title = title
        self.issued = issued

    def searchableText(self):
        return self.title

class Edit(grok.EditForm):
    pass

class Index(grok.DisplayForm):
    pass
